package com.xx.ems.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

/**
 * @author xxx
 * @date 2014-2-25
 * @version 1.0
 * 描述: 部门表
 */
@Entity
public class Departments {
	/**
	 * 描述：主键
	 */
	private Integer did;
	/**
	 * 描述：部门名称
	 */
	private String dname;
	/**
	 * 描述：父亲节点
	 */
	private Integer parent_id;
	/**
	 * 描述：用户表关联对象
	 */
	private Set<Users> users = new HashSet<Users>();
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="did",unique=true,nullable=false)
	public Integer getDid() {
		return did;
	}
	public void setDid(Integer did) {
		this.did = did;
	}
	@Column(name="dname",length=30,nullable=false)
	public String getDname() {
		return dname;
	}
	public void setDname(String dname) {
		this.dname = dname;
	}
	@Column(name="parent_id",nullable=false)
	public Integer getParent_id() {
		return parent_id;
	}
	public void setParent_id(Integer parent_id) {
		this.parent_id = parent_id;
	}
	@OneToMany(targetEntity=Users.class,mappedBy="department")
	public Set<Users> getUsers() {
		return users;
	}
	public void setUsers(Set<Users> users) {
		this.users = users;
	}
}
